<?php
session_start();
include_once('includes/auth.php');
$error='';
if(isset($_SESSION['id']))
{
	header('location:index.php');
}
if(isset($_GET['attempt']))
{
	
	$log=new login;
    $error=$log->authenticate($_POST['uname'],$_POST['pword']);
		
}	
function menu()
{
?>	
	
<?php	
}
?>
<?php
include_once('header.php');
?>
<?php echo $error;?>
<h2>User login</h2>
<form action='login.php?attempt=1' method='POST'>
	<table>
		<tr><td>Username:</td><td><input type='text' name='uname'/></td></tr>
		<tr><td>Password:</td><td><input type='password' name='pword'/></td></tr>
		<tr><td><input type='submit' value='login'/></td><td></td></tr>
	</table>
	
</form>


<?php
include_once('footer.php');
?>